package com.treeHole.treeHoleServer.pojo;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private Integer code;//返回的响应码，1为成功，0为失败
    private String msg;
    private Object data;

    //增删改所用统一返回值
    public static Result success() {
        return new Result(1, "success", null);
    }

    //查询所用统一返回值
    public static Result success(Object data) {
        return new Result(1, "success", data);
    }

    //失败所用统一返回值
    public static Result error(String msg) {
        return new Result(0, msg, null);
    }
}
